#include "com_voe_VoEAudioProcessing.h"
#include "jni_api.h"
#include "OutputParam.h"
#include "voe_audio_processing.h"
#include "VoERxVadCallbackImpl.h"

static VoERxVadCallbackImpl _VoERxVadCallback;

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetInterface
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL Java_com_voe_VoEAudioProcessing_GetInterface
	(JNIEnv* env, jclass cls, jlong p_voiceEngine)
{
	return (jlong)webrtc::VoEAudioProcessing::GetInterface((webrtc::VoiceEngine*)p_voiceEngine);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    Release
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_Release
	(JNIEnv* env, jclass cls, jlong p)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->Release();
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetNsStatus
 * Signature: (JZI)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetNsStatus
	(JNIEnv* env, jclass cls, jlong p, jboolean enable, jint mode)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->SetNsStatus(enable!=0, (webrtc::NsModes)mode);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetNsStatus
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetNsStatus
	(JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	bool enable;
	webrtc::NsModes mode;
	jint result = pVoEAudioProcessing->GetNsStatus(enable, mode);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(enable).add((int)mode).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetAgcStatus
 * Signature: (JZI)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetAgcStatus
	(JNIEnv* env, jclass cls, jlong p, jboolean enable, jint mode)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->SetAgcStatus(enable!=0, (webrtc::AgcModes)mode);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetAgcStatus
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetAgcStatus
	(JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	bool enable;
	webrtc::AgcModes mode;
	jint result = pVoEAudioProcessing->GetAgcStatus(enable, mode);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(enable).add((int)mode).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetAgcConfig
 * Signature: (JSSZ)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetAgcConfig
  (JNIEnv* env, jclass cls, jlong p, jshort targetLeveldBOv, jshort digitalCompressionGaindB, jboolean limiterEnable)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	webrtc::AgcConfig config;
	config.targetLeveldBOv = targetLeveldBOv;
	config.digitalCompressionGaindB = digitalCompressionGaindB;
	config.limiterEnable = limiterEnable!=0;
	return pVoEAudioProcessing->SetAgcConfig(config);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetAgcConfig
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetAgcConfig
  (JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	webrtc::AgcConfig config = {0};
	jint result = pVoEAudioProcessing->GetAgcConfig(config);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job
			.add((int)config.targetLeveldBOv)
			.add((int)config.digitalCompressionGaindB)
			.add(config.limiterEnable).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetEcStatus
 * Signature: (JZI)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetEcStatus
  (JNIEnv* env, jclass cls, jlong p, jboolean enable, jint mode)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->SetEcStatus(enable!=0, (webrtc::EcModes)mode);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetEcStatus
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetEcStatus
  (JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	bool enable;
	webrtc::EcModes mode;
	jint result = pVoEAudioProcessing->GetEcStatus(enable, mode);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(enable).add((int)mode).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    EnableDriftCompensation
 * Signature: (JZ)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_EnableDriftCompensation
  (JNIEnv* env, jclass cls, jlong p, jboolean enable)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->EnableDriftCompensation(enable!=0);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    DriftCompensationEnabled
 * Signature: (J)Z
 */
JNIEXPORT jboolean JNICALL Java_com_voe_VoEAudioProcessing_DriftCompensationEnabled
  (JNIEnv* env, jclass cls, jlong p)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->DriftCompensationEnabled();
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    DriftCompensationSupported
 * Signature: (J)Z
 */
JNIEXPORT jboolean JNICALL Java_com_voe_VoEAudioProcessing_DriftCompensationSupported
  (JNIEnv* env, jclass cls, jlong p)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->DriftCompensationSupported();
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetDelayOffsetMs
 * Signature: (JI)V
 */
JNIEXPORT void JNICALL Java_com_voe_VoEAudioProcessing_SetDelayOffsetMs
	(JNIEnv* env, jclass cls, jlong p, jint offset)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	pVoEAudioProcessing->SetDelayOffsetMs(offset);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    DelayOffsetMs
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_DelayOffsetMs
	(JNIEnv* env, jclass cls, jlong p)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->DelayOffsetMs();
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetAecmMode
 * Signature: (JIZ)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetAecmMode
	(JNIEnv* env, jclass cls, jlong p, jint mode, jboolean enableCNG)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->SetAecmMode((webrtc::AecmModes)mode, enableCNG!=0);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetAecmMode
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetAecmMode
	(JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	bool enable;
	webrtc::AecmModes mode;
	jint result = pVoEAudioProcessing->GetAecmMode(mode, enable);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add((int)mode).add(enable).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    EnableHighPassFilter
 * Signature: (JZ)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_EnableHighPassFilter
	(JNIEnv* env, jclass cls, jlong p, jboolean enable)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->EnableHighPassFilter(enable!=0);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    IsHighPassFilterEnabled
 * Signature: (J)Z
 */
JNIEXPORT jboolean JNICALL Java_com_voe_VoEAudioProcessing_IsHighPassFilterEnabled
  (JNIEnv* env, jclass cls, jlong p)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->IsHighPassFilterEnabled();
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetRxNsStatus
 * Signature: (JIZI)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetRxNsStatus
  (JNIEnv* env, jclass cls, jlong p, jint channel, jboolean enable, jint mode)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->SetRxNsStatus(channel, enable!=0, (webrtc::NsModes)mode);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetRxNsStatus
 * Signature: (JILcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetRxNsStatus
	(JNIEnv* env, jclass cls, jlong p, jint channel, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	bool enable;
	webrtc::NsModes mode;
	jint result = pVoEAudioProcessing->GetRxNsStatus(channel, enable, mode);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(enable).add((int)mode).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetRxAgcStatus
 * Signature: (JIZI)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetRxAgcStatus
	(JNIEnv* env, jclass cls, jlong p, jint channel, jboolean enable, jint mode)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->SetRxAgcStatus(channel, enable!=0, (webrtc::AgcModes)mode);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetRxAgcStatus
 * Signature: (JILcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetRxAgcStatus
	(JNIEnv* env, jclass cls, jlong p, jint channel, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	bool enable;
	webrtc::AgcModes mode;
	jint result = pVoEAudioProcessing->GetRxAgcStatus(channel, enable, mode);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(enable).add((int)mode).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetRxAgcConfig
 * Signature: (JISSZ)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetRxAgcConfig
  (JNIEnv* env, jclass cls, jlong p, jint channel, jshort targetLeveldBOv, jshort digitalCompressionGaindB, jboolean limiterEnable)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	webrtc::AgcConfig config;
	config.targetLeveldBOv = targetLeveldBOv;
	config.digitalCompressionGaindB = digitalCompressionGaindB;
	config.limiterEnable = limiterEnable!=0;
	return pVoEAudioProcessing->SetRxAgcConfig(channel, config);
	
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetRxAgcConfig
 * Signature: (JILcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetRxAgcConfig
	(JNIEnv* env, jclass cls, jlong p, jint channel, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	webrtc::AgcConfig config = {0};
	jint result = pVoEAudioProcessing->GetRxAgcConfig(channel, config);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job
			.add((int)config.targetLeveldBOv)
			.add((int)config.digitalCompressionGaindB)
			.add(config.limiterEnable).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    RegisterRxVadObserver
 * Signature: (JILcom/voe/callback/VoERxVadCallback;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_RegisterRxVadObserver
  (JNIEnv* env, jclass cls, jlong p, jint channel, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	if(_VoERxVadCallback.set(env, obj))
	{
		return pVoEAudioProcessing->RegisterRxVadObserver(channel, _VoERxVadCallback);
	}
	return JCB_Err_Set;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    DeRegisterRxVadObserver
 * Signature: (JI)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_DeRegisterRxVadObserver
  (JNIEnv* env, jclass cls, jlong p, jint channel)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	jint result = pVoEAudioProcessing->DeRegisterRxVadObserver(channel);
	if(result == 0)
		_VoERxVadCallback.unset(env);
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    VoiceActivityIndicator
 * Signature: (JI)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_VoiceActivityIndicator
  (JNIEnv* env, jclass cls, jlong p, jint channel)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->VoiceActivityIndicator(channel);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetEcMetricsStatus
 * Signature: (JZ)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetEcMetricsStatus
	(JNIEnv* env, jclass cls, jlong p, jboolean enable)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->SetEcMetricsStatus(enable!=0);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetEcMetricsStatus
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetEcMetricsStatus
  (JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	bool enable = false;
	jint result = pVoEAudioProcessing->GetEcMetricsStatus(enable);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(enable).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetEchoMetrics
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetEchoMetrics
	(JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	int ERL, ERLE, RERL, A_NLP;
	jint result = pVoEAudioProcessing->GetEchoMetrics(ERL, ERLE, RERL, A_NLP);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(ERL).add(ERLE).add(RERL).add(A_NLP).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetEcDelayMetrics
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetEcDelayMetrics
	(JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	int delay_median, delay_std;
	jint result = pVoEAudioProcessing->GetEcDelayMetrics(delay_median, delay_std);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(delay_median).add(delay_std).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    StartDebugRecording
 * Signature: (JLjava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_StartDebugRecording
  (JNIEnv* env, jclass cls, jlong p, jstring fileNameUTF8)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->StartDebugRecording(JniHelper::j2c_string(env, fileNameUTF8).c_str());
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    StopDebugRecording
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_StopDebugRecording
  (JNIEnv* env, jclass cls, jlong p)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->StopDebugRecording();
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetTypingDetectionStatus
 * Signature: (JZ)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetTypingDetectionStatus
	(JNIEnv* env, jclass cls, jlong p, jboolean enable)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->SetTypingDetectionStatus(enable!=0);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    GetTypingDetectionStatus
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_GetTypingDetectionStatus
	(JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	bool enable = false;
	jint result = pVoEAudioProcessing->GetTypingDetectionStatus(enable);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(enable).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    TimeSinceLastTyping
 * Signature: (JLcom/voe/common/OutputParam;)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_TimeSinceLastTyping
	(JNIEnv* env, jclass cls, jlong p, jobject obj)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	int seconds = 0;
	jint result = pVoEAudioProcessing->TimeSinceLastTyping(seconds);
	if(result == 0)
	{
		JniOutputBuilder job(env);
		OutputParam param(env, obj);
		param.setArray(job.add(seconds).getOutput());
	}
	return result;
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    SetTypingDetectionParameters
 * Signature: (JIIIII)I
 */
JNIEXPORT jint JNICALL Java_com_voe_VoEAudioProcessing_SetTypingDetectionParameters
	(JNIEnv* env, jclass cls, jlong p, jint timeWindow, jint costPerTyping, jint reportingThreshold, 
	jint penaltyDecay, jint typeEventDelay)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->SetTypingDetectionParameters(timeWindow, costPerTyping, reportingThreshold, 
		penaltyDecay, typeEventDelay);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    EnableStereoChannelSwapping
 * Signature: (JZ)V
 */
JNIEXPORT void JNICALL Java_com_voe_VoEAudioProcessing_EnableStereoChannelSwapping
  (JNIEnv* env, jclass cls, jlong p, jboolean enable)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	pVoEAudioProcessing->EnableStereoChannelSwapping(enable!=0);
}

/*
 * Class:     com_voe_VoEAudioProcessing
 * Method:    IsStereoChannelSwappingEnabled
 * Signature: (J)Z
 */
JNIEXPORT jboolean JNICALL Java_com_voe_VoEAudioProcessing_IsStereoChannelSwappingEnabled
  (JNIEnv* env, jclass cls, jlong p)
{
	webrtc::VoEAudioProcessing* pVoEAudioProcessing = (webrtc::VoEAudioProcessing*)p;
	return pVoEAudioProcessing->IsStereoChannelSwappingEnabled();
}
